package com.xyazm.order.utils;

import com.xyazm.order.domain.entity.OrderInfoDO;
import com.xyazm.common.enums.OrderTypeEnum;
import com.xyazm.product.enums.ProductTypeEnum;

public class OrderTypeUtils {

    /**
     * 订单类型
     * @author xuyou
     * 2023-02-02 22:30
     * @param productType
     * @param orderInfoDO
    */
    public static void getOrderType(Integer productType, OrderInfoDO orderInfoDO) {
        ProductTypeEnum productTypeEnum = ProductTypeEnum.getByCode(productType);
        if (ProductTypeEnum.NORMAL.equals(productTypeEnum)) {
            orderInfoDO.setOrderType(OrderTypeEnum.NORMAL.getCode());
        } else if (ProductTypeEnum.VIRTUAL.equals(productTypeEnum)) {
            orderInfoDO.setOrderType(OrderTypeEnum.VIRTUAL.getCode());
        } else if (ProductTypeEnum.PRE_SALE.equals(productTypeEnum)) {
            orderInfoDO.setOrderType(OrderTypeEnum.PRE_SALE.getCode());
        }
    }

}
